-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Recode cob_decimal_pow function - Fix for #924, #925, #989 - add test cases for power operator #182
base: gcos4gnucobol-3.x
Are you sure you want to change the base?
Conversation
- Fixe #924, #925, #989 - add tests case for power operator
Hello @denishug and thank you for your contribution. It is usually requested that contributors add an entry to Example in our PR #191 (merged) |
libcob/intrinsic.c
Outdated
/* Fix #925 : Avoid GMPLIB CRASH */ | ||
|
||
mpf_set(cob_mpft3,cob_mpft) ; | ||
if ( sign_nbr == -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space before condition
libcob/intrinsic.c
Outdated
|
||
Process_case_0: | ||
if (sign_nbr == 0) { | ||
if ( sign_exp == 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove space before condition
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this nice piece of work. I think the Changelog entries could be improved and there are some code parts + formatting, but overall quite good!
AT_CHECK([$COMPILE prog.cob], [0], [], []) | ||
AT_CHECK([$COBCRUN_DIRECT ./prog], [0], [], []) | ||
AT_CLEANUP | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor beautify: please separate test cases with a double empty line - also above
AT_CLEANUP | ||
|
||
AT_SETUP([Power size error and limits cases 2]) | ||
AT_KEYWORDS([POWER]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Words that are in AT_SETUP are automatically added to the keyword list. Replacing it with the main statement - here COMPUTE - would be useful (also applies above).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add an m4 comment about which tests are for which bug report - this provides more context and is also useful in the future
libcob/intrinsic.c
Outdated
break; | ||
|
||
case 0: | ||
goto Process_case_0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is a single case for this - please inline instead of using goto
libcob/intrinsic.c
Outdated
mpz_set_ui (pd1->value, 1UL); | ||
pd1->scale = 0; | ||
return; | ||
goto Compute_Power; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please reorder that case to have zero first, this can then return
while the fall-through of 1/-1 is easier to follow and we don't need the Compute_Power
label any more
libcob/intrinsic.c
Outdated
sign_nbr = mpz_sgn(pd1->value); | ||
sign_exp = mpz_sgn(pd2->value); | ||
|
||
power_case = sign_nbr * sign_exp; | ||
|
||
cob_trim_decimal(pd2); | ||
cob_trim_decimal(pd1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please reformat to use a space before the parenthesis (also applies to other places)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I've fixed the merge conflicts in the Changelogs, resolving all open issues on these. Otherwise I can also handle that when doing the commit upstream - just give me a note how we want to handle that. |
run_fundametal.at : add #1020 ticket test
d262205
to
14e8b5f
Compare
No description provided.